//
//  JWSingleSite.h
//  JWBrowser
//
//  Created by Dejun Liu on 14-11-11.
//  Copyright (c) 2014年 JW. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>

typedef void(^Complation)(id responseData , NSError *error); // obj可能是dic、array

@interface NetworkService : NSObject

@property(nonatomic,strong) AFHTTPRequestOperationManager *manager;
@property(nonatomic,strong) AFURLSessionManager *sessionClient;

JW_SINGLETON_INTERFACE(NetworkService);

//直接post一个二进制流
- (void)postDataString:(NSString *)dataString urlString:(NSString *)urlString jsonResponse:(Complation) complation;


// json格式使用
- (void)getURLString:(NSString *)url params:(NSDictionary *)params jsonResponse:(Complation ) complation;
- (void)postURLString:(NSString *)url params:(NSDictionary *)prarams jsonResponse:(Complation) complation;

//上传文件使用
- (void)uploadData:(NSData *) data key:(NSString *)key apiURL:(NSString *)url completion:(Complation) completion;
- (void)uploadFileWithPath:(NSString *) path key:(NSString *)key apiURL:(NSString *)url completion:(Complation) completion;
- (void)uploadMultiKeyValue:(NSDictionary *)dic apiURL:(NSString *)url completion:(Complation) completion;

@end
